home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / Aztec C v5.2a disk 4.adf / 204inc_h.lzh / devices / scsidisk.h < prev    next >
C/C++ Source or Header  |  1991-03-14  |  4KB  |  120 lines

  1. #ifndef    DEVICES_SCSIDISK_H
  2. #define    DEVICES_SCSIDISK_H
  3. /*
  4. **    $Filename: devices/scsidisk.h $
  5. **    $Release: 2.04 $
  6. **    $Revision: 36.2 $
  7. **    $Date: 90/11/07 $
  8. **
  9. **    SCSI exec-level device command
  10. **
  11. **    (C) Copyright 1988,1989,1990 Commodore-Amiga, Inc.
  12. **        All Rights Reserved
  13. */
  14.  
  15.  
  16. #ifndef EXEC_TYPES_H
  17. #include "exec/types.h"
  18. #endif /* EXEC_TYPES_H */
  19.  
  20.  
  21.  
  22. /*--------------------------------------------------------------------
  23.  *
  24.  *   SCSI Command
  25.  *    Several Amiga SCSI controller manufacturers are converging on
  26.  *    standard ways to talk to their controllers.  This include
  27.  *    file describes an exec-device command (e.g. for hddisk.device)
  28.  *    that can be used to issue SCSI commands
  29.  *
  30.  *   UNIT NUMBERS
  31.  *    Unit numbers to the OpenDevice call have encoded in them which
  32.  *    SCSI device is being referred to.  The three decimal digits of
  33.  *    the unit number refer to the SCSI Target ID (bus address) in
  34.  *    the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  35.  *    and the controller board in the 100's digit.
  36.  *
  37.  *    Examples:
  38.  *          0    drive at address 0
  39.  *         12    LUN 1 on multiple drive controller at address 2
  40.  *        104    second controller board, address 4
  41.  *         88    not valid: both logical units and addresses
  42.  *            range from 0..7.
  43.  *
  44.  *   CAVEATS
  45.  *    Original 2090 code did not support this command.
  46.  *
  47.  *    Commodore 2090/2090A unit numbers are different.  The SCSI
  48.  *    logical unit is the 100's digit, and the SCSI Target ID
  49.  *    is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  50.  *    (7 is reserved for the controller).
  51.  *
  52.  *        Examples:
  53.  *          3    drive at address 0
  54.  *        109    drive at address 6, logical unit 1
  55.  *          1    not valid: this is not a SCSI unit.  Perhaps
  56.  *            it's an ST506 unit.
  57.  *
  58.  *    Some controller boards generate a unique name (e.g. 2090A's
  59.  *    iddisk.device) for the second controller board, instead of
  60.  *    implementing the 100's digit.
  61.  *
  62.  *    There are optional restrictions on the alignment, bus
  63.  *    accessability, and size of the data for the data phase.
  64.  *    Be conservative to work with all manufacturer's controllers.
  65.  *
  66.  *------------------------------------------------------------------*/
  67.  
  68. #define    HD_SCSICMD    28    /* issue a SCSI command to the unit */
  69.                 /* io_Data points to a SCSICmd */
  70.                 /* io_Length is sizeof(struct SCSICmd) */
  71.                 /* io_Actual and io_Offset are not used */
  72.  
  73. struct SCSICmd {
  74.     UWORD  *scsi_Data;        /* word aligned data for SCSI Data Phase */
  75.                 /* (optional) data need not be byte aligned */
  76.                 /* (optional) data need not be bus accessable */
  77.     ULONG   scsi_Length;    /* even length of Data area */
  78.                 /* (optional) data can have odd length */
  79.                 /* (optional) data length can be > 2**24 */
  80.     ULONG   scsi_Actual;    /* actual Data used */
  81.     UBYTE  *scsi_Command;    /* SCSI Command (same options as scsi_Data) */
  82.     UWORD   scsi_CmdLength;    /* length of Command */
  83.     UWORD   scsi_CmdActual;    /* actual Command used */
  84.     UBYTE   scsi_Flags;        /* includes intended data direction */
  85.     UBYTE   scsi_Status;    /* SCSI status of command */
  86.     UBYTE  *scsi_SenseData;    /* sense data: filled if SCSIF_[OLD]AUTOSENSE */
  87.                 /* is set and scsi_Status has CHECK CONDITION */
  88.                 /* (bit 1) set */
  89.     UWORD   scsi_SenseLength;    /* size of scsi_SenseData, also bytes to */
  90.                 /* request w/ SCSIF_AUTOSENSE, must be 4..255 */
  91.     UWORD   scsi_SenseActual;    /* amount actually fetched (0 means no sense) */
  92. };
  93.  
  94.  
  95. /*----- scsi_Flags -----*/
  96. #define    SCSIF_WRITE        0    /* intended data direction is out */
  97. #define    SCSIF_READ        1    /* intended data direction is in */
  98. #define    SCSIB_READ_WRITE    0    /* (the bit to test) */
  99.  
  100. #define    SCSIF_NOSENSE        0    /* no automatic request sense */
  101. #define    SCSIF_AUTOSENSE        2    /* do standard extended request sense */
  102.                     /* on check condition */
  103. #define    SCSIF_OLDAUTOSENSE    6    /* do 4 byte non-extended request */
  104.                     /* sense on check condition */
  105. #define    SCSIB_AUTOSENSE        1    /* (the bit to test) */
  106. #define    SCSIB_OLDAUTOSENSE    2    /* (the bit to test) */
  107.  
  108. /*----- SCSI io_Error values -----*/
  109. #define    HFERR_SelfUnit        40    /* cannot issue SCSI command to self */
  110. #define    HFERR_DMA        41    /* DMA error */
  111. #define    HFERR_Phase        42    /* illegal or unexpected SCSI phase */
  112. #define    HFERR_Parity        43    /* SCSI parity error */
  113. #define    HFERR_SelTimeout    44    /* Select timed out */
  114. #define    HFERR_BadStatus        45    /* status and/or sense error */
  115.  
  116. /*----- OpenDevice io_Error values -----*/
  117. #define    HFERR_NoBoard        50    /* Open failed for non-existant board */
  118.  
  119. #endif    /* DEVICES_SCSIDISK_H */
  120.